package com.apress.prospringintegration.messageflow.filter;

import com.apress.prospringintegration.messageflow.domain.MarketItem;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageSelector;
import org.springframework.stereotype.Component;

/**
 * Created by IntelliJ IDEA.
 * User: wenwei
 * Date: 4/18/11
 * Time: 2:22 PM
 * To change this template use File | Settings | File Templates.
 */
@Component
public class MessageSelectorStockItemFilter implements MessageSelector {
    @Override
    public boolean accept(Message<?> message) {
        MarketItem item = (MarketItem) message.getPayload();
        return (item != null && item.getType().equals("stock"));
    }
}
